package com.dubbo.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dubbo.ITransferAPI;
import org.springframework.web.bind.annotation.*;

@RestController
public class TransferController {

    @Reference
    private ITransferAPI iTransferAPI;

    @GetMapping("/{money}")
    public String transfer(@PathVariable("money") Integer money) {
        boolean result = iTransferAPI.doTransfer("user_account_a", "user_account_b", money);
        if (result) {
            return "转账成功！";
        } else {
            return "转账失败！";
        }
    }
}
